package kr.co.boogui.helper;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import kr.co.boogui.dao.MemberDAO;
import kr.co.boogui.model.MemberVO;


@WebServlet("/idcheck.bi")
public class Idcheck extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
	protected void doGet(HttpServletRequest req, HttpServletResponse res) 
			throws ServletException, IOException {
		res.setContentType("text/html; charset=UTF-8");
		PrintWriter out = res.getWriter();
		MemberVO m = new MemberVO();
		m.setUid(req.getParameter("juid"));
		boolean mv = MemberDAO.idcheck(m);
		if (mv) { //중복일때
			out.print( "<p style ='color:red; '>사용중인 아이디입니다.</p>");
		} else {  //아닐때
			out.print( "<p style ='color:blue;'>사용가능한 아이디입니다.</p>");
		}
		out.close();
	}
}
